import Vue from 'vue'
import VueRouter from 'vue-router'
import layout from '@/views/layout'
import manageinfo from './modules/manageinfo'
import managebusiness from './modules/managebusiness'
import managestorage from './modules/managestorage'
import managestoragein from './modules/managestoragein'
import managestorageout from './modules/managestorageout'
Vue.use(VueRouter)

// 基础路由 谁都能看
const contantRoutes = [
  {
    path: '/login',
    component: () => import('@/views/login')
  },
  {
    path: '/',
    component: layout,
    redirect: '/dashboard',
    children: [
      {
        path: 'dashboard',
        name: 'dashboard',
        component: () => import('@/views/dashboard'),
        meta: { title: '工作台', icon: 'icon-caidan' }
      }
    ]
  }
]

// 动态路由
const asyncRoutes = [
  manageinfo,
  managebusiness,
  managestorage,
  managestoragein,
  managestorageout
]

const router = new VueRouter({
  routes: [...contantRoutes, ...asyncRoutes]
})

export default router
